package com.ofps.flow.service.impl;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ofps.flow.mapper.EnterFlowNodeMapper;
import com.ofps.flow.domain.EnterFlowNode;
import com.ofps.flow.service.IEnterFlowNodeService;

import javax.annotation.Resource;

/**
 * 流程节点Service业务层处理
 *
 * @author ofps
 * @date 2022-06-01
 */
@Service
public class EnterFlowNodeServiceImpl extends ServiceImpl<EnterFlowNodeMapper, EnterFlowNode> implements IEnterFlowNodeService {
    @Resource
    EnterFlowNodeMapper enterFlowNodeMapper;

    /**
     * 查询流程节点列表
     *
     * @param enterFlowNode 流程节点
     * @return 流程节点
     */
    @Override
    public List<EnterFlowNode> selectEnterFlowNodeList(EnterFlowNode enterFlowNode) {
        return baseMapper.selectEnterFlowNodeList(enterFlowNode);
    }

//    @Override
//    public Integer InsertNode(Map<String, Object> node) {
////        System.out.println(node);
//        EnterFlowNode enterFlowNode = new EnterFlowNode();
//        if(null != node.get("flowId"))
//            enterFlowNode.setFlowId(node.get("flowId").toString());
//        if(null != node.get("id"))
//                enterFlowNode.setId(node.get("id").toString());
//        if(null != node.get("last")){
//            String last = node.get("last").toString();
//            Integer lastvalue = 0;
//            if(last.equals("true"))
//                lastvalue = 1;
//            else
//                lastvalue = 0;
//            enterFlowNode.setLast(lastvalue);
//        }
//        if(null != node.get("name"))
//            enterFlowNode.setName(node.get("name").toString());
//        if(null != node.get("order"))
//            enterFlowNode.setOrderId(Long.parseLong(node.get("order").toString()));
//        if(null != node.get("relatedUserId"))
//            enterFlowNode.setRelatedUserId(Long.parseLong(node.get("relatedUserId").toString()));
//        if(null != node.get("flowInfo"))
//            enterFlowNode.setNodeInfo(node.get("flowInfo").toString());
//        System.out.println(enterFlowNode);
//
//        enterFlowNodeMapper.insert(enterFlowNode);
//        return 1;
//    }

    @Override
    public void insert(EnterFlowNode node) {
        enterFlowNodeMapper.insert(node);
    }

}
